package Operation;

import Book.Book;
import Book.Bookshelf;

import java.util.Scanner;

public class findBookOperate implements IOOperation{
    public void work(Bookshelf bookshelf) {

        System.out.println("查找图书........");
        Scanner s = new Scanner(System.in);
        System.out.println("请输入要查找的图书：");
        String name = s.nextLine();
        Book[] books = bookshelf.getBookList();
        for (int i = 0; i < bookshelf.getUsedSize(); i++) {
            if(name.equals(books[i].getName())) {
                System.out.println(books[i]);
                return;
            }


        }
        System.out.println("馆里还没有这本 "+name+" 书");


    }
}
